package com.wzdigit.wms.wms.rpc.basic;

import com.wzdigit.wms.basic.domain.dtos.inventory.GetUserWhsZoneWorkDivisionDto;
import com.wzdigit.wms.wms.api.basic.WorkDivisionApi;
import com.wzdigit.wms.basic.client.response.basic.UserWhsZoneWorkDivisionResponse;
import com.wzdigit.wms.wms.dto.basic.GetUserWhsZoneWorkDivisionApiDto;
import com.wzdigit.wms.wms.service.core.WorkDivisionCoreService;
import com.wzdigit.wms.wms.vo.basic.UserWhsZoneWorkDivisionApiVo;
import lombok.extern.slf4j.Slf4j;
import net.dreamlu.mica.core.utils.BeanUtil;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Slf4j
@Service(version = "${dubbo.providers.wms.workdivision.api:1.0.0}")
public class WorkDivisionApiImplService implements WorkDivisionApi{
	
	@Autowired
	private WorkDivisionCoreService workDivisionCoreService;
	
	@Override
	public List<UserWhsZoneWorkDivisionApiVo> getUserWhsZoneWorkDivision(GetUserWhsZoneWorkDivisionApiDto dto) {
		GetUserWhsZoneWorkDivisionDto workDivisionDto = new GetUserWhsZoneWorkDivisionDto();
		BeanUtil.copyNonNull(dto, workDivisionDto);
		List<UserWhsZoneWorkDivisionResponse> list = workDivisionCoreService.getUserWhsZoneWorkDivision(workDivisionDto);
		List<UserWhsZoneWorkDivisionApiVo> results = BeanUtil.copy(list, UserWhsZoneWorkDivisionApiVo.class);
		return results;
	}
}